<?php

namespace App\Http\Controllers\Api\V1;

use App\B2BProject\Area;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class MemberController extends Controller
{
    /**
     * 获取用户信息
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function getInformation()
    {
        $user = \Auth::user();

        return success_return([
            'name'           => $user->user,
            'company'        => $user->information->company,
            'balance_amount' => 0,
            'protect_amount' => 0,
            'freeze_amount'  => 0,
        ]);
    }

    public function getSpecInformation()
    {
        $user = \Auth::user();

        return success_return([
            'name'           => $user->user,
            'company'        => $user->information->company,
            'contact_person' => $user->information->contact_person,
            'contact_phone'  => $user->information->contact_phone,
            'contact_email'  => $user->information->contact_email,
            'area'           => Area::getName($user->information->province_id) .
                                Area::getName($user->information->city_id) .
                                Area::getName($user->information->county_id),
            'address'        => $user->information->address,
        ]);
    }
}
